package org.ww.product.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.ww.product.service.SkuInfoService;
import org.ww.product.vo.SkuItemVo;

import java.util.concurrent.ExecutionException;

/**
 * @program: gmall
 * @description: 商品详情controller
 * @author: ww
 * @create: 2024-04-29 13:48
 **/
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;
    /**
     * 查询商品详情
     * @param skuId
     * @return
     */
    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        SkuItemVo skuItemVo = skuInfoService.item(skuId);
        model.addAttribute("item",skuItemVo);
        return "item";
    }

}
